﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                double n = Convert.ToDouble(txtNumber.Text);

                if (n < 0)
                    txtResult.Text = "-1";
                else if (n == 0)
                    txtResult.Text = "0";
                else
                    txtResult.Text = "1";
            }
            catch (Exception ex)
            {
                MessageBox.Show("请输入有效的数字！");
            }
        }
    }
}
